import java.util.*;
public class test {
    // 牛客 游游的you
    public static void main0(String[] args) {
        Scanner in = new Scanner(System.in);
        // a个'y'
        // b个'o'
        // c个'u'
        int q = in.nextInt();
        while (q-- > 0) {
            int sum = 0;
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int min = Math.min(a, Math.min(b, c));
            sum += (min * 2);
            b -= min;
            sum += b != 0 ? (b - 1) : 0;
            System.out.println(sum);
        }
    }
    // 牛客 腐烂的苹果
    public int row;
    public int col;
    public int sum;
    public int mintime;
    public boolean[][] count;
    public boolean[][] apples;
    public Queue<int[]> queue;
    public int[] dx = {0, 0, 1, -1};
    public int[] dy = {1, -1, 0, 0};
    public int INF = 0x3f3f3f3f;
    public int[][] nums;
    public int rotApple (ArrayList<ArrayList<Integer>> grid) {
    // write code here
        row = grid.size();
        col = grid.get(0).size();
        mintime = INF;
        queue = new LinkedList<>();
        nums = new int[row][col];
        count = new boolean[row][col];
        apples = new boolean[row][col];
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                nums[i][j] = grid.get(i).get(j);
                //记录普通苹果数量
                //如果某次bfs中,腐蚀苹果数量 = 普通苹果数量,则代表全部腐蚀
                //不对!应该所有苹果同时腐烂!
                if (nums[i][j] == 1) {
                    sum++;
                }
            }
        }
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if (grid.get(i).get(j) == 2) {
                    queue.add(new int[]{i,j});
                }
            }
        }bfs();
        return mintime == INF ? -1 : mintime;
    }
    public void bfs() {
        for (int i = 0; i < row; i++) {
            Arrays.fill(count[i], false);
        }
        //[0]存储x,[1]存储y
        int thisSum = 0;
        int time = 0;
        while (!queue.isEmpty()) {
            int size = queue.size();
            for (int j = 0; j < size; j++) {
                int[] t = queue.poll();
                for (int i = 0; i < 4; i++) {
                    int x = t[0] + dx[i];
                    int y = t[1] + dy[i];
                    // 1.x,y不越界
                    // 2.x,y处未被访问过
                    // 3.x,y处为苹果
                    if (x >= 0 && x < row && y >= 0 && y < col && !count[x][y] && nums[x][y] == 1) {
                        thisSum++;
                        count[x][y] = true;
                        queue.add(new int[]{x, y});
                        if (thisSum == sum) {
                            mintime = Math.min(mintime, time + 1);
                            return;
                        }
                    }
                }
            }
            time++;
        }
    }
    // 牛客 孩子们的游戏(约瑟夫环)
    public int LastRemaining_Solution (int n, int m) {
    // write code here
        List<Integer> list = new ArrayList<>();
        for(int i = 0;i < n;i++){
            list.add(i);
        }
        int index = 0;
        int delete = 0;
        while(list.size() > 1){
            index += m - 1;
            if(index >= list.size()){
                index %= list.size();
            }
            list.remove(index);
        }
        return list.get(0);
    }
}
